#安装
# pip install bs4

import requests
import urllib3
from bs4 import BeautifulSoup

# 取消警告
requests.packages.urllib3.disable_warnings()
http = urllib3.PoolManager(num_pools=50)

headers = {
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"
}

domain = "https://dytt89.com/"

# verify=False 不进行安全验证
resp = requests.get(domain, verify=False, headers=headers)
# 设置字符集与网页的一直，否则中文会乱码，网页的字符集可以在网页源代码的开头看到
resp.encoding = "gb2312"

# html.parser 是告知这是一个html语句
page = BeautifulSoup(resp.text,"html.parser")
#可以连续find
s = page.find("div",attrs={"class":"co_area2"}).find_all("a")

print(s)

for i in s:
    # 通过get 获取标签属性
    href = i.get('href')
    print(href)

